<template>
  <div v-if="isShow" class="reply_comment">
    <div class="reply_mask" @click="clickCancle()"></div>
    <div class="reply_comment-bottom">
      <textarea class="reply_bottom-textarea" cursor-spacing="80" v-model="content" focus placeholder-style="color:#666666" :placeholder="placeholder"></textarea>
      <div class="reply_bottom-view" id="bottomView">
        <div class="reply_send-btn" @click="clickSend()">发送</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "replyComment",
  props: {
    placeholder: {
      type: String,
      default: '请输入评论内容…'
    }
  },
  data() {
    return {
      isShow: false,
      content: ''
    };
  },
  methods: {
    clickSend() {
      this.$emit('sendComment', this.content);
      this.content = '';
      this.isShow = false;
    },
    open() {
      this.isShow = true;
    },
    clickCancle() {
      this.isShow = false;
    }
  }
}
</script>

<style scoped lang="scss">
.reply_comment {
  z-index: 2;
  width: 100%;
  height: 100%;
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
}

.reply_mask {
  width: 100%;
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
}

.reply_mask-hidden {
  display: none;
}

.reply_comment-bottom {
  display: flex;
  flex-direction: column;
  width: 100%;
  background-color: white;
  position: absolute;
  bottom: 0;

  .reply_bottom-textarea {
    margin: 0 auto;
    width: 92%;
    margin-top: 10px;
    height: 105px;
    border-bottom: 1px solid #f6f6f6;
  }

  .reply_bottom-view {
    margin: 0px 15px;
    display: flex;
    height: 40px;
    justify-content: flex-end;
    align-items: center;
    flex-direction: row;

    .reply_send-btn {
      width: 50px;
      text-align: end;
      font-size: 15px;
      align-items: center;
      color: #d81e07;
    }
  }
}
</style>
